import { apiRequest } from "../utils/request";

//我的帖子（分页）
export function getMyPostList(data: any): Promise<commonTypes.ApiRowResponse<myTypes.myPostList>> {
  return apiRequest({
    url: `/userPost/myPost`,
    method: "get",
    data,
  });
}
//发布
export function publishUserPost(data: any) {
  return apiRequest({
    url: `/userPost/publish`,
    method: "post",
    data,
  });
}
//获取帖子详情
export function getUserPostInfo(data: any): Promise<commonTypes.ApiResponse<orderTypes.orderDetails>> {
  return apiRequest({
    url: `/userPost/getInfo`,
    method: "POST",
    data,
  });
}
//删除帖子
export function deletePost(data: any) {
  return apiRequest({
    url: `/userPost/deletePost`,
    method: "POST",
    data,
  });
}
//关闭/开启评论
export function changeCommentFlag(data: any) {
  return apiRequest({
    url: `/userPost/changeCommentFlag`,
    method: "POST",
    data,
  });
}
//获取帖子的评论
export function getCommentListByPostId(data: any): Promise<commonTypes.ApiRowResponse<orderTypes.commentList>> {
  return apiRequest({
    url: `/postComment/getListByPostId`,
    method: "get",
    data,
  });
}

//评论
export function postComment(data: any) {
  return apiRequest({
    url: `/postComment/comment`,
    method: "POST",
    data,
  });
}
//查看楼层所有回复
export function getSubComment(data: any) {
  return apiRequest({
    url: `/postComment/getSubComment`,
    method: "get",
    data,
  });
}

//帖子点赞
export function likeUserPost(data: any) {
  return apiRequest({
    url: `/userPost/like`,
    method: "POST",
    data,
  });
}
//帖子取消点赞
export function unlikeUserPost(data: any) {
  return apiRequest({
    url: `/userPost/unlike`,
    method: "POST",
    data,
  });
}
//帖子列表（分页）
export function getPostList(data: any) {
  return apiRequest({
    url: `/userPost/getPostList`,
    method: "get",
    data,
  });
}
//被申请好友记录列表
export function getApplyList() {
  return apiRequest({
    url: `/userFriends/getApplyList`,
    method: "get",
  });
}

//同意申请
export function agreeFriend(data: any) {
  return apiRequest({
    url: `/userFriends/agree`,
    method: "post",
    data,
  });
}
//拒绝申请
export function refuseFriend(data: any) {
  return apiRequest({
    url: `/userFriends/refuse`,
    method: "post",
    data,
  });
}
//获取系统消息列表（分页）
export function getMessageList(data: any): Promise<commonTypes.ApiRowResponse<HomeTypes.msgRow>> {
  return apiRequest({
    url: `/message/getList`,
    method: "get",
    data,
  });
}
//获取系统消息未读消息条数
export function getUnReadCount() {
  return apiRequest({
    url: `/message/getUnReadCount`,
    method: "get",
  });
}
//申请好友
export function applyFriend(data: any) {
  return apiRequest({
    url: `/userFriends/apply`,
    method: "post",
    data,
  });
}
//判断是否是好友
export function getFriendStatus(data: any) {
  return apiRequest({
    url: `/userFriends/getFriendStatus`,
    method: "get",
    data,
  });
}

//去置顶
export function promotion(data: any) {
  return apiRequest({
    url: `/userPost/promotion`,
    method: "post",
    data,
  });
}
//获取用户名片详情
export function getCardMainInfo(data: any) {
  return apiRequest({
    url: `/card/getMainInfo`,
    method: "post",
    data,
  });
}
